home *** CD-ROM | disk | FTP | other *** search
/ Quick PC 61 / Quick PC 61.iso / I386 / RUNW32.BAT < prev    next >
Encoding:
DOS Batch File  |  2003-04-22  |  2.5 KB  |  103 lines

  1. @rem = '
  2. @goto endofperl
  3. ';
  4. #+---------------------------------------------------------------------------
  5. #
  6. #  File:       R U N W 3 2 . B A T
  7. #
  8. #  Contents:   Perl/cmd script to prevent fatal page fault when using Win9x
  9. #             and running winnt32.exe from a network share.
  10. #
  11. #  Author:     kumarp 21-August-98
  12. #
  13. #  Notes:  
  14. #    Windows95 does not allow an executable on a network share to be copied
  15. # to pagefile before executing it, it simply runs it directly
  16. # from the network share. In case of a network problem, this results
  17. # in a fatal pagefault error. 
  18. #
  19. #   This script is written with the aim to avoid this problem when
  20. # running winnt32.exe from the ntbuilds release shares. It simply
  21. # copies all winnt32.exe files (~ 4MB) to a temporary directory on the 
  22. # local hard drive. It does not copy the entire release share to your
  23. # hard drive. It then launches winnt32.exe from the local hard drive.
  24. #
  25. #----------------------------------------------------------------------------
  26.  
  27. my $usage_help = "Usage:  runw32.bat [any option valid for winn32.exe]";
  28.  
  29. if ($ARGV[0] =~ /[-\/]([hH?]|(help))/i)
  30. {
  31.     print $usage_help;
  32.     exit;
  33. }
  34.  
  35. if (rindex($0, '\\') >= 0)
  36. {
  37.     $curdir = substr($0, 0, rindex($0, '\\'));
  38. }
  39. else
  40. {
  41.     $curdir = `cd`;
  42. }
  43.  
  44. chomp($curdir);
  45.  
  46. $tempDir = $ENV{"TEMP"};
  47. $winnt32_src = $curdir;
  48. $winnt32_dst = "$tempDir\\winnt32";
  49. print "Please wait while files are being copied from $winnt32_src to $winnt32_dst...\n";
  50. `xcopy /q/s/d $winnt32_src\\*.* $winnt32_dst`;
  51. die "...error copying files from $winnt32_src: $!\n" if ($? != 0);
  52.  
  53. $nt5_src=$curdir;
  54. if ($nt5_src =~ /(.+)winnt32$/i)
  55. {
  56.     $nt5_src = $1;
  57. }
  58.  
  59. $cmdline = "$winnt32_dst\\winnt32.exe /s:$nt5_src " . join(" ", @ARGV);
  60. print "$cmdline\n";
  61. `$cmdline`;
  62. #`rd /s/q $winnt32_dst`;
  63. #`deltree /y $winnt32_dst`;
  64. __END__
  65. :endofperl
  66. @echo off
  67.  
  68. set THISFILE=%0
  69. if not exist %THISFILE% set THISFILE=%0.bat
  70.  
  71. if "%TEMP%"=="" goto not_set_temp
  72. if "%TMP%"=="" goto not_set_temp
  73. set ARGS=
  74. :loop
  75. if .%1==. goto endloop
  76. set ARGS=%ARGS% %1
  77. shift
  78. goto loop
  79. :endloop
  80.  
  81. set WINNT32_DIR=%TEMP%\winnt32
  82. if not exist %WINNT32_DIR% md %WINNT32_DIR%
  83.  
  84. rem Need to find a good location for perl.exe
  85.  
  86. set PERL=\\kumarp1\public\perl\perl.exe
  87. if not exist %PERL% set PERL=\\scratch\scratch\kumarp\perl\perl.exe
  88. if not exist %PERL% goto perl_not_found
  89.  
  90. %PERL% %THISFILE% %ARGS%
  91.  
  92. goto the_end
  93.  
  94. :perl_not_found
  95. echo Cannot load %PERL%
  96. goto the_end
  97.  
  98. :not_set_temp
  99. echo Environment variable TEMP or TMP is not set
  100. goto the_end
  101.  
  102. :the_end
  103.